﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using SharedGenomics.Core;
using SharedGenomics.Domain;

namespace SharedGenomics.Annotations
{
    [Serializable]
    public class GeneSummaryAnnotation : IAnnotation
    {
        private Gene _gene;

        public GeneSummaryAnnotation(Gene gene)
        {
            this.Gene = gene;
        }

        public Gene Gene
        {
            get { return this._gene; }
            set
            {
                value.ThrowIfNull("Gene");
                this._gene = value;
            }
        }

        public AnnotationKey AnnotationKey
        {
            get { return AnnotationKey.Gene; }
        }

        public string Description
        {
            get { return String.Format("Gene: {0}", Gene.Name ?? "<null>"); }
        }

        public string EncodedKey
        {
            get
            {
                return "<annotation type=\"Gene\"><entrezGeneId>" + System.Security.SecurityElement.Escape(Gene.ToString()) + "</entrezGeneId></annotation>";
            }
        }
    }
}
